<template>
    <div>
        <div class="searchHeader">
            <el-input v-model="keyWords" placeholder="请输入搜索关键字..." class="articleSearchText" size="mini"></el-input>
            <el-button @click="initLogs" size="mini" type="primary" icon="el-icon-search">搜索日志</el-button>
        </div>
        <div>
            <el-table
                    border
                    :data="logData"
                    stripe
                    style="width: 100%">
                <el-table-column
                        prop="id"
                        label="编号">
                </el-table-column>
                <el-table-column
                        prop="addr"
                        label="IP地址">
                </el-table-column>
                <el-table-column
                        prop="time"
                        label="时间">
                </el-table-column>
                <el-table-column
                        prop="operation"
                        label="行为">
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button
                                size="mini"
                                type="danger"
                                @click="">删除
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
    export default {
        name: "LogManage",
        data(){
            return {
                logData : [],
                keyWords: ''
            }
        },
        methods:{
            initLogs() {
                this.$getRequest('/log/?keyWords='+this.keyWords).then(resp => {
                    if (resp) {
                        this.logData = resp;
                    }
                })
            }
        },
        mounted() {
            this.initLogs();
        }
    }
</script>

<style scoped>
    .searchHeader .articleSearchText {
        width: 300px;
        margin-bottom: 10px;
        margin-right: 10px;
    }
</style>